package com.dfrz.ch05.task;

/**
 * 作者：wangmaokang
 * 日期: 2021/4/12 14:55
 * 描述:
 */
public class Task06 {
    public static void main(String[] args) {

        int[][] a = {{1, 0, 0, 1}, {0, 1, 1, 0}, {1, 1, 0, 0}};
        System.out.println("-------转置前-------");
        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < a[i].length; j++) {
                System.out.print(a[i][j] + " ");
            }
            System.out.println();
        }
        int[][] b = new int[a[0].length][a.length];

        System.out.println("------转置后------");

        for (int i=0;i<a.length;i++){
            for (int j=0;j<a[i].length;j++){

                int c=(a[i].length-1)-j;

                b[c][i]=a[i][j];

            }
        }
        for (int i=0;i<b.length;i++){
            for (int j=0;j<b[i].length;j++){
                System.out.print(b[i][j]+"\t");
            }
            System.out.println("");
        }




//        for (int i = 0; i < b.length; i++) {
//
//            for (int j = 0; j < b[i].length; j++) {
////转换
//                b[j][i] = a[4-j][i];
//                System.out.print(b[i][j] + " ");
//            }
//            System.out.println();
//        }
    }
}
